/********************************************************************
Name: Table A18: Effect of Dem Sheriff on Detainer Compliance Rate,
	State Detainer Policy vs No Policy
Author: Dan Thompson
Date: August 2019
Notes:
********************************************************************/

* Set the working directory 
gl root = "$sanctuary_root"
gl root = "YOUR_WORKING_DIRECTORY"

* Bring in the RD analysis data
use "$root/data/panel analysis data.dta", clear

* Create a variable noting when state policies go in place
gen state_policy = state=="OR" | ///
	(inlist(state, "CA", "CT") & policy_year>=2013) | ///
	(state=="CO" & inrange(policy_year,2007,2013)) | ///
	(state=="VA" & policy_year>=2015) | ///
	(inlist(state,"AL","SC") & policy_year>=2011) | ///
	(inlist(state,"NH","OH") & policy_year>=2009) | ///
	(state=="AZ" & policy_year>=2007)
gen dem_state_policy = dem*state_policy

* Column 1
reg share_detained_sheriff dem_state_policy dem state_policy, vce(clust county_id)

* Column 2
reg share_detained_sheriff dem_state_policy dem state_policy i.year, vce(clust county_id)

* Column 3
reg share_detained_sheriff dem_state_policy dem state_policy i.year log_foreign pres00_dem, vce(clust county_id)

* Column 4
xtreg share_detained_sheriff dem_state_policy dem state_policy i.year, i(county_id) fe vce(clust county_id)
